from django import forms
from content.models import UserShopping

class GoodSearchForm(forms.ModelForm):


    class Meta:
        model = UserShopping
        fields = ['user','goods']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        for name, field in self.fields.items():
            field.widget.attrs = {"class": "layui-input", "placeholder": "请输入" + field.label,}

class GoodForm(forms.ModelForm):


    class Meta:
        model = UserShopping
        fields = ['user','goods']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        for name, field in self.fields.items():
            field.widget.attrs = {"class": "layui-input", "placeholder": "请输入" + field.label,'lay-verify':"required"}

